package cn.lili.modules.urbansubstation.client;

import cn.lili.modules.constant.ServiceConstant;
import cn.lili.modules.urbansubstation.entity.dos.UrbanSubstation;
import cn.lili.modules.urbansubstation.entity.dto.UrbanSubstationDTO;
import cn.lili.modules.urbansubstation.entity.dto.UrbanSubstationSearchPageParams;
import cn.lili.modules.urbansubstation.entity.vos.UrbanSubstationVo;
import cn.lili.modules.urbansubstation.fallback.UrbanSubstationFallback;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(path = "${server.servlet.context-path}", name = ServiceConstant.URBAN_SUBSTATION_SERVICE, contextId = "urban-substation", fallback = UrbanSubstationFallback.class)
public interface UrbanSubstationClient {
    /**
     * 获取当前登录城市分站信息
     *
     * @return 店铺信息DO
     */
    @GetMapping("/feign/urban_substation/{userId}/getUrbanSubstation")
    UrbanSubstation getUrbanSubstation(@PathVariable String userId);

    /**
     * 增加城市分站
     * 用于后台添加
     *
     * @param urbanSubstationDTO 后台添加城市分站信息
     * @return 城市分站
     */
    @PostMapping("/feign/urban_substation/addUrban")
    UrbanSubstation addUrban(@RequestBody UrbanSubstationDTO urbanSubstationDTO);

    /**
     * 分页查询城市分站
     *
     * @param urbanSubstationSearchPageParams 查询参数
     * @return 城市分站分页
     */
    @PostMapping("/feign/urban_substation/page")
    Page<UrbanSubstationVo> page(@RequestBody UrbanSubstationSearchPageParams urbanSubstationSearchPageParams);

    /**
     * 根据城市ID获取城市站点信息
     * @param areaId 城市ID
     * @return
     */
    @GetMapping("/feign/urban_substation/getByAreaId")
    UrbanSubstation getByAddressId (@RequestParam String areaId);

    /**
     * 根据城市ID获取城市站点信息
     * @param id 城市ID
     * @return
     */
    @GetMapping("/feign/urban_substation/getById")
    UrbanSubstation getById (@RequestParam String id);

    /**
     * 获取城市站点下拉列表
     * @return
     */
    @GetMapping("/feign/select")
    List<UrbanSubstation> select();

    /**
     * 根据城市ID获取城市站点信息
     * @param searchPageParams
     * @return
     */
    @PostMapping("/feign/urban_substation/getByRegionIds")
    Page<UrbanSubstation> getByRegionIds (@RequestBody UrbanSubstationSearchPageParams searchPageParams);
}
